<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAgentLetterTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('agent_website_letter', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('agent_id')->index()->comment('代理商 ID');
            $table->bigInteger('website_letter_id')->index()->comment('站内信 ID');
            $table->tinyInteger('website_letter_range_type')->default(2)->comment('站内信范围类型; 1:所有人 2:指定成员');
            $table->tinyInteger('status')->default(1)->comment('状态; 1:未读 2:已读');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('agent_website_letter');
    }
}
